%define project admin-tweak
%define commit 5c2df3a85b2a748d1a8044164ec0566aadfaf5d3
%define commit_short %(echo %{commit} | head -c6)

Summary(ru_RU.UTF-8):	Графическая утилита для администрирования МОС
Summary:	MOS administrative tools with GUI
Name:		admin-tweak
Version:	2
Release:	1.git%{commit_short}.1
License:	GPLv3
Group:		System/Configuration/Other
Url:		https://hub.mos.ru/mos/src/admin-tweak
Vendor:		MOS
Source0:	https://hub.mos.ru/mos/src/%{project}/-/archive/%{commit}/%{name}-%{commit}.tar.gz
BuildArch:	noarch
Requires:	python3-qtpy
Requires:	py-ini-config
BuildRequires:	desktop-file-utils
Recommends:	polkit

%description
%{summary}.

%description -l ru_RU.UTF-8
Графическая утилита для администрирования МОС.

%files
%{_datadir}/%{project}
%{_bindir}/%{project}
%{_sbindir}/%{project}
%{_datadir}/applications/%{project}.desktop
%{_datadir}/polkit-1/actions/ru.mos.os.%{name}.policy
%{_iconsdir}/hicolor/scalable/apps/%{name}.svg

#------------------------------------------------------------------

%prep
%autosetup -p1 -n %{name}-%{commit}

%install
mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/polkit-1/actions
mkdir -p %{buildroot}%{_datadir}/%{project}
mkdir -p %{buildroot}%{_sbindir}
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_iconsdir}/hicolor/scalable/apps

cp -R * %{buildroot}%{_datadir}/%{project}
ln -s /usr/share/%{project}/main.py %{buildroot}%{_sbindir}/%{project}
install -m755 %{name}.sh %{buildroot}%{_bindir}/%{name}
install -m644 ru.mos.os.%{name}.policy %{buildroot}%{_datadir}/polkit-1/actions
install -m644 %{name}.svg %{buildroot}%{_iconsdir}/hicolor/scalable/apps
desktop-file-install %{name}.desktop
